package cz.spock.cms.template.entity;

import java.io.StringReader;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;

import com.googlecode.objectify.annotation.Unindexed;

/**
 * Represents data holder for freemarker templates.
 * Name must be specified and unique!
 * 
 * Reader is used for purposes of TemplateLoader, as templates will be stored in database.
 * 
 * @author miso
 *
 */
@Entity
public class TemplateSource {
    
    @Id
    private Long id;
    @Unindexed
    private Date lastModified;
    private String name;
    @Unindexed
    private String description;
    @Unindexed
    private String template;
    @Transient
    private StringReader reader;
    
    
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Date getLastModified() {
        return lastModified;
    }
    public void setLastModified(Date lastModified) {
        this.lastModified = lastModified;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getTemplate() {
        return template;
    }
    public void setTemplate(String template) {
        this.template = template;
    }
    public StringReader getReader() {
        return reader;
    }
    public void setReader(StringReader reader) {
        this.reader = reader;
    }

}
